package models

// 优惠码
type MaCouponCode struct {
	ID          string `gorm:"primaryKey;column:id;autoIncrement;type:bigint unsigned;not null;comment:唯一ID" json:"id" json_old:"ID"`
	BatchID     string `gorm:"column:batch_id;type:bigint;not null;comment:优惠码活动ID" json:"batch_id"`
	Code        string `gorm:"column:code;type:varchar(10);not null;comment:优惠码" json:"code"`
	Status      int    `gorm:"column:status;type:tinyint(1);not null;default:1;comment:优惠码状态 1待使用2已使用3已失效" json:"status"`
	TotalTimes  int    `gorm:"column:total_times;type:int;default:-1;comment:优惠码可复用次数，默认-1无限制次数" json:"total_times"`
	UnusedTimes int    `gorm:"column:unused_times;type:int;default:-1;comment:优惠码剩余使用次数,默认-1无限制次数" json:"unused_times"`
	UseTime     int    `gorm:"-" json:"use_time"`
	OutTradeNo  string `gorm:"-" json:"out_trade_no"`
	CreatedAt   int64  `gorm:"column:created_at;autoCreateTime;type:int;size:64;comment:创建时间" json:"created_at"`
	UpdatedAt   int64  `gorm:"column:updated_at;autoUpdateTime;type:int;size:64;comment:修改时间" json:"updated_at"`
	DeletedAt   int64  `gorm:"column:deleted_at;type:int;size:64;default:0;comment:删除时间" json:"deleted_at"`
}

func (m MaCouponCode) TableName() string {
	return "ma_coupon_code"
}
